<?php if(!defined('WDK_PATH')) exit('No direct script access allowed');
abstract class WwwController extends WdkController
{	
	function __construct()
	{
		parent::__construct();
		require_once PROJECT_PATH.'config/config.php';
		$this->config = $config;
		
		$this->tpl = new Template_();
		$this->tpl->compile_dir = CACHE_PATH.'tpl_/_compile';
		$this->tpl->template_dir = BASE_PATH;
		$this->tpl->cache_dir = CACHE_PATH.'tpl_/_cache';
		$this->uri = Wdk::helper('Uri');		

		$this->skin = '';
		$this->skindir = '/';
		if($this->skin != '')
		{
			$this->skin = $this->config['skin'];
			$this->skindir = '/skins/'.$this->skin.'/';			
		}

		$this->tpl->assign('skin', $this->skin);
		$this->tpl->assign('skindir', $this->skindir);
	}
	
	protected function _view($data = array(), $file='main')
	{
		global $_SESSION;

		$this->tpl->define('view', $this->skindir.$this->uri['class'].'/'.$this->uri['method'].'.html');
		$this->tpl->assign($data);
		$this->tpl->assign('session', $_SESSION);
		$view = $this->tpl->fetch('view');
		
		$this->tpl->define('_CONTENTS_', '_layout/default.html');
		$this->tpl->assign('view', $view);
		print($this->tpl->fetch('_CONTENTS_'));
	}
	protected function _isLogin(){}
	protected function _loginPage(){}
}